package br.ufrj.dcc.trabxml.view;

import java.awt.BorderLayout;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class FormHistory extends JFrame {
	//private String[] columns = new String [] {"Tipo", "Remetente", "Destinatatio", "Dono", "ISBN", "Data/Hora", "Status"};
//	private String[][] data= { 
//			{"Emprestimo", "1", "2", "2", "20-20000-20", "17/11/2007", "Ok"}
//	};
	
	private void initComponents() {
		pack();
	}
	
	/** Creates new form FormBook */
    public FormHistory() {
        initComponents();
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setTitle("Historico");
    }
    
    public void setVisible(boolean v) {
        pack();
        setSize(getWidth(),getHeight()+10);
        setLocationRelativeTo(null);        
        super.setVisible(true);
    }
    
    public void showHistoryTable(Vector<Vector<String>> data) {
    	Vector<String> columns = new Vector<String>();
    	columns.add("Tipo");
    	columns.add("Remetente");
    	columns.add("Destinatario");
    	columns.add("Dono");
    	columns.add("ISBN");
    	columns.add("Data/Hora");
    	columns.add("Status");
    	
    	JTable table = new JTable(data, columns);
		JScrollPane scrollPane = new JScrollPane(table);
		table.setFillsViewportHeight(true);
		setLayout(new BorderLayout());
		add(table.getTableHeader(), BorderLayout.PAGE_START);
		add(table, BorderLayout.CENTER);
    }
}
